package com.retail.booking.controller;

import com.retail.booking.client.BookingPosterClient;
import com.retail.booking.entity.request.BookingShareRecordRequest;
import com.retail.booking.entity.request.BookingUserCreateShareRequest;
import com.retail.booking.entity.vo.BookingSharePosterConfigVo;
import com.retail.core.entity.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @author gaoya
 */
@Api(value = "小核酸海报API", tags = "小核酸海报API")
@RestController
@RequestMapping("api/bookingposter")
public class BookingPosterApiController {

    private final BookingPosterClient bookingPosterClient;

    public BookingPosterApiController(BookingPosterClient bookingPosterClient) {
        this.bookingPosterClient = bookingPosterClient;
    }

    /**
     * 默认只能使用一个海报信息
     * @return Result 返回结果
     */
    @ApiOperation("得到海报信息")
    @GetMapping("getPoster")
    public Result<BookingSharePosterConfigVo> getPoster() {
        return bookingPosterClient.getPoster();
    }

    /**
     * 生成分享记录
     * @return
     */
    @ApiOperation("生成分享记录")
    @PostMapping("createUserBookingShareRecord")
    public Result createBookingShareRecord(@RequestBody BookingUserCreateShareRequest request) {
        return bookingPosterClient.createBookingShareRecord(request);
    }

    /**
     * 也就是前端的保存图片、。
     * @return
     */
    @ApiOperation("分享记录")
    @PostMapping("saveShareRecord")
    public Result saveShareRecord(@RequestBody BookingShareRecordRequest request) {
        return bookingPosterClient.saveShareRecord(request);
    }
}

